﻿using System;

using System.Collections.Generic;
using System.Text;
using PasswordSafe.Classes;

namespace PasswordSafe.Classes
{
    public class PWNameValue:NotifyItemBase
    {
        public PWNameValue(string title, string name, PasswordData data)
        {
            this.Name = name;
            this.data = data;
            this.Title = title;
        }
        private PasswordData data;

        public string Title { get; set; }
        public string Name { get; set; }
        public string Value
        {
            get { return data.Values[Name]; }
            set 
            {
                if (value != data.Values[Name])
                {
                    if (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(data.Values[Name])) return;
                    data.Values[Name] = value;
                    Modify();
                }
            }
        }
    }
}
